package com.espirit.init.biz;

import org.springframework.stereotype.Component;

import com.espirit.eap.pagelayout.LinkedButton;
import com.espirit.finance.core.AcctItemBuilderSupport;
import com.espirit.hr.SalaryAcct;
import com.espirit.hr.SalaryAcctItem;
import com.espirit.hr.SalaryAcctItemFactor;
import com.espirit.hr.SalaryAcctItemRef;

@Component
public class SalaryAcctItemBuilder extends AcctItemBuilderSupport {
	static final String DEPTIDS = "deptIds";
	static final String DEPTNAMES = "deptNames";
	
	static final String WORKGROUP = "workGroup";
	static final String ATTRIBUTE = "employeeAttribute";
//	static final String WORKGROUPNAMES = "workGroupNames";
	
	@Override
	public boolean init() {
		return super.setClass(SalaryAcctItem.class, "Salary Item Standard", "工资标准");
	}
	
	@Override
		protected void addParentField() {
			addModelField(PARENT, "Salary Acct", "工资条目");
		}

	@Override
	public void buildFields() {
		super.buildFields();
		addModelField(DEPTIDS, "Departments", "应用部门");
		addModelField(DEPTNAMES, "Departments", "应用部门");
		
		addModelField(WORKGROUP, "Workgroup", "应用组");
		addModelField(ATTRIBUTE, "Employee Attribute", "劳动者身份");
//		addModelField(WORKGROUPNAMES, "WorkGroup", "应用组");
	}

	@Override
	protected void addListFields() {
		LinkedButton lb = createActiveLinkedButton();
		listElements.add(lb);
		addListField(convertPropertyToField(PARENT, NAME, ACCTITEMREF, FACTOR, STYLE, FIXEDAMOUNT, DEPTNAMES, WORKGROUP, ATTRIBUTE, REMARK));
	}
	
	@Override
	protected void addDetailFields() {
		addDetailField(convertPropertyToField(PARENT, NAME, ACTIVE, STYLE, ACCTITEMREF, FACTOR, FIXEDAMOUNT, CONDITIONAMOUNT, DEPTIDS, WORKGROUP, ATTRIBUTE, CONDITION, REMARK));
	}
//	
	@Override
	protected void gatherExproperties() {
		exProperties.put(REQUIRED, new String[]{NAME, ACTIVE, DEPTIDS});
	}

	@Override
	protected String getParentClassName() {
		return SalaryAcct.class.getName();
	}

	@Override
	protected String getAcctItemRefClassName() {
		return SalaryAcctItemRef.class.getName();
	}
	
	@Override
	protected String getAcctItemFactorClassName() {
		return SalaryAcctItemFactor.class.getName();
	}

}
